<?php
/**
 * 仓库
 * Created by PhpStorm.
 * User: echa
 * Date: 2018/3/5
 * Time: 11:19
 */

namespace App\Http\Controllers\WarehouseManage;
use App\Services\Warehouse\WarehouseService;
use App\Http\Controllers\ApiController;
use Illuminate\Http\Request;
class  WarehouseController extends ApiController{
   protected $WarehouseService;
   public function __construct(WarehouseService $WarehouseService)
   {
       $this->WarehouseService=$WarehouseService;
   }

    /**
     *
     * 获取仓库列表
     */
   public function GetWarehouseList(){
       $list=$this->WarehouseService->ListWarehouse();
       return $list;
   }

   /**
   *   根据仓库编号或者仓库ID获取对应仓库信息
    */
   public function GetWarehouseInfo(Request $request){
       $FStockId=$request->k3_stockid;
       $FNumber=$request->k3_number;
       if(!empty($FStockId)){
           $info=$this->WarehouseService->ListWarehouse($FStockId);
       }else if(!empty($FNumber)){
           $info=$this->WarehouseService->ListWarehouse('',$FNumber);
       }else{

           return $this->failed('参数缺失');
       }
       return $info;
   }
}